var base = getApp();
var common = require('../../utils/common.js');
Page({

  /**
   * 页面的初始数据
   */
  data: { region: ["广东省","广州市","从化区"],
  index: 0,
    
    arrTime: ['选择配送时间', '10:00-11:00', '11:00-12:00', '12:00-13:00', '13:00-14:00', '14:00-15:00', '15:00-16:00', '16:00-17:00', '17:00-18:00'],
  objectArrTime: [
      {id: 0, name: '选择配送时间'},
      {id: 1, name: '10:00-11:00'},
      {id: 2, name: '11:00-12:00'},
      {id: 3, name: '12:00-13:00'},
      {id: 4, name: '13:00-14:00'},
      {id: 5, name: '14:00-15:00'},
      {id: 6, name: '15:00-16:00'},
      {id: 7, name: '16:00-17:00'},
      {id: 8, name: '17:00-18:00'}],
  arrTimeIndex: 0,
 
  addrShow: false,
  scrollTop: 100,
  selectedID: -1,
  oinfo: {
      OrderSource: "all|web",
      Consignee: "",
      Cellphone: "",
      City: "",
      District: "",
      Address: "",
      DeliveryDate: "",
      DeliveryTime: "",
      Payment: "",
      Remarks: "",
      TotalPrice: 0
  },
  dateStart: "2017-01-01",
  dateEnd: "2017-01-01",
 
 
},

  // 收货地址bindtap
   bindPickerChange: function(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      index: e.detail.value
    })
  },
  // 配送日期bindtap
  bindDateChange: function (e) {
    this.setData({
        "oinfo.DeliveryDate": e.detail.value
    })
},
  // 配送时间bindtap
bindTimeChange: function (e) {
  var _this = this;
  if (e.detail.value > 0) {
      _this.setData({
          arrTimeIndex: e.detail.value,
          "oinfo.DeliveryTime": _this.data.arrTime[e.detail.value]
      });
  }
},

  regionChange: function(e) {
    this.setData({region: e.detail.value});
    
    
  },
  gettap:function(e){
    wx.reLaunch({
      url: '../demo1/demo1',
    })
     
  },
  location:function(e){
    wx.navigateTo({
      url: "../location/location",
    })
  },
 handletap:function(e){
    wx.navigateTo
     ({
      url: '../goumai/goumai',
     
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})